package com.thyme.controller;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.thyme.dao.UserDao;
import com.thyme.entity.User;
import com.thyme.service.UserMultipleSerice;
import com.thyme.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;
import java.util.UUID;

/**
 * @Author Thyme
 * @Date 2021/2/4 17:15
 * @Description TODO
 **/
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserController {

    private final UserDao userDao;

    private final UserMultipleSerice userMultipleSerice;

    @GetMapping("/add")
    private int add(){
        User user = new User();
        user.setUuid(UUID.randomUUID().toString().replace("-",""));
        user.setName(UUID.randomUUID().toString().replace("-",""));
        user.setAge(new Random().nextInt());
        return userMultipleSerice.save(user);
    }

}
